
/**
* @module create-opposite-read
* @author: Hjava
* @description: 创建对端已读模块(群聊名字不一样,也放在此模块中)
* @since: 2018-07-23 12:31:33
*/
Object.defineProperty(exports, "__esModule", { value: true });
var OppositeReadCreator = /** @class */ (function () {
    function OppositeReadCreator() {
    }
    OppositeReadCreator.prototype.createChatOppositeRead = function (_a) {
        var myUid = _a.myUid, _b = _a.data, uid = _b.uid, type = _b.type, peerAppId = _b.peerAppId, sid = _b.sid, channelId = _b.channelId, mids = _b.mids;
        if (true) {
            var IM = __webpack_require__(/*! _core/im */ "./src/core/im/index.ts").default;
            if (sid) {
                var item = new IM.Session.IMOppositeSyncReadItem2({
                    chatId: uid,
                    type: type,
                    peerAppId: peerAppId,
                    channel: channelId,
                    msgIds: mids,
                    sid: sid
                });
                return new IM.Session.IMOppositeSyncRead2({
                    uid: myUid,
                    syncReadItems: [item]
                });
            }
            else {
                var item = new IM.Session.IMOppositeSyncReadItem({
                    chatId: uid,
                    type: type,
                    peerAppId: peerAppId,
                    channel: channelId,
                    msgIds: mids
                });
                return new IM.Session.IMOppositeSyncRead({
                    uid: myUid,
                    syncReadItems: [item]
                });
            }
        }
    };
    OppositeReadCreator.prototype.createGroupReceiptMessage = function (_a) {
        var _b = _a.fromUid, fromUid = _b === void 0 ? '' : _b, _c = _a.toGuid, toGuid = _c === void 0 ? '' : _c, _d = _a.channelId, channelId = _d === void 0 ? 0 : _d, _e = _a.messageItems, messageItems = _e === void 0 ? [] : _e;
        if (true) {
            var IM_1 = __webpack_require__(/*! _core/im */ "./src/core/im/index.ts").default;
            var items = messageItems.map(function (item) {
                return new IM_1.Session.IMReceiptGroupItem({
                    msgUuid: item.uuid,
                    toUid: item.toUid,
                    msgId: item.mid
                });
            });
            return new IM_1.Session.IMReceiptGroupMsgs({
                fromUid: fromUid,
                toGuid: toGuid,
                channel: channelId,
                items: items
            });
        }
    };
    OppositeReadCreator.prototype.createPubOppositeRead = function (_a) {
        var myUid = _a.myUid, _b = _a.data, _c = _b.uid, uid = _c === void 0 ? '0' : _c, _d = _b.peerUid, peerUid = _d === void 0 ? '0' : _d, _e = _b.type, type = _e === void 0 ? 1 : _e, _f = _b.peerAppId, peerAppId = _f === void 0 ? 0 : _f, _g = _b.channelId, channelId = _g === void 0 ? 0 : _g, sid = _b.sid, _h = _b.sts, sts = _h === void 0 ? 0 : _h;
        if (true) {
            var PUB = __webpack_require__(/*! _core/pub */ "./src/core/pub/index.ts").default;
            if (sid) {
                var item = new PUB.Session.PubOppositeSyncReadItem2({
                    chatId: uid,
                    peerUid: peerUid,
                    type: type,
                    peerAppId: peerAppId,
                    channel: channelId,
                    sts: sts,
                    sid: sid
                });
                return new PUB.Session.PubOppositeSyncRead2({
                    uid: myUid,
                    syncReadItems: [item]
                });
            }
            else {
                var item = new PUB.Session.PubOppositeSyncReadItem({
                    chatId: uid,
                    peerUid: peerUid,
                    type: type,
                    peerAppId: peerAppId,
                    channel: channelId,
                    sts: sts
                });
                return new PUB.Session.PubOppositeSyncRead({
                    uid: myUid,
                    syncReadItems: [item]
                });
            }
        }
    };
    return OppositeReadCreator;
}());
exports.default = new OppositeReadCreator();


//# sourceURL=webpack://MTDX/./src/extra/utils/opposite-read-creator.ts?